unit ufTask_Property_ActionRunApp;

interface

uses
  Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
  Vcl.Controls, Vcl.Forms, Vcl.Dialogs, ufTask_Property_ActionCustom, uTasks,
  Vcl.StdCtrls, Vcl.ExtCtrls;

type
  TfTask_Property_ActionRunApp = class(TTfTask_Property_ActionCustom)
    OpenDialog: TOpenDialog;
    eAppFileName: TButtonedEdit;
    lExtFormFileName: TLabel;
    Label1: TLabel;
    eAppParams: TMemo;
    procedure eAppFileNameRightButtonClick(Sender: TObject);
  private
  public
    procedure Prepare(AStep: TStep); override;
    procedure Save; override;
    procedure Check; override;
  end;

implementation

{$R *.dfm}

uses
  u1cAgentServerConst;

{ TfTask_Property_ActionRunApp }

procedure TfTask_Property_ActionRunApp.Check;
begin
  eAppFileName.Text:=Trim(eAppFileName.Text);
  if eAppFileName.Text='' then begin
    eAppFileName.SetFocus;
    raise Exception.Create(sSRV_43);
  end;
  eAppParams.Text:=Trim(eAppParams.Text);
end;

procedure TfTask_Property_ActionRunApp.eAppFileNameRightButtonClick(
  Sender: TObject);
begin
  OpenDialog.InitialDir:= ExtractFilePath(eAppFileName.Text);
  if OpenDialog.Execute(Handle) then
    eAppFileName.Text:= OpenDialog.FileName;
end;

procedure TfTask_Property_ActionRunApp.Prepare(AStep: TStep);
begin
  inherited;
  eAppFileName.Text:= AStep.AppName;
  eAppParams.Text:= AStep.AppParams;
end;

procedure TfTask_Property_ActionRunApp.Save;
begin
  FStep.AppName:= eAppFileName.Text;
  FStep.AppParams:= eAppParams.Text;
end;

end.
